home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / OS / FWGraphx / Include / FWRgnShp.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  4.6 KB  |  166 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRgnShp.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWRGNSHP_H
  13. #define FWRGNSHP_H
  14.  
  15. #ifndef FWSHAPE_H
  16. #include "FWShape.h"
  17. #endif
  18.  
  19. #ifndef FWINK_H
  20. #include "FWInk.h"
  21. #endif
  22.  
  23. #ifndef FWStyle_H
  24. #include "FWStyle.h"
  25. #endif
  26.  
  27. // ----- OpenDoc Includes -----
  28.  
  29. #ifndef _SHAPE_
  30. #include <Shape.h>
  31. #endif
  32.  
  33. //========================================================================================
  34. //    •• Forward Declarations
  35. //========================================================================================
  36.  
  37. class FW_CGraphicContext;
  38. class FW_CRegionShapeRep;
  39. class XMPShape;
  40. class FW_COvalShape;
  41. class FW_CRoundRectShape;
  42. class FW_CArcShape;
  43. class FW_CLineShape;
  44. class FW_CRectShape;
  45.  
  46. //========================================================================================
  47. //    •• CLASS FW_CRegionShape
  48. //========================================================================================
  49.  
  50. class FW_CRegionShape : public FW_CShape
  51. {
  52. //----------------------------------------------------------------------------------------
  53. //    • Constructors
  54. //
  55. public:
  56.     FW_CRegionShape();
  57.     FW_CRegionShape(XMPShape* shape);
  58.     FW_CRegionShape(const FW_CRect& rect);
  59.     
  60.     FW_CRegionShape(const FW_CRegionShape& other);
  61.     FW_CRegionShape(FW_CRegionShapeRep* rep);
  62.             
  63. //----------------------------------------------------------------------------------------
  64. //    • Operators
  65. //
  66. public:
  67.     FW_CRegionShape& operator=(const FW_CRegionShape& other);
  68.     FW_CRegionShape& operator=(FW_CRegionShapeRep* other);
  69.         
  70.     FW_CRegionShapeRep* operator->() const
  71.                 {return (FW_CRegionShapeRep*)GetRep();}
  72.     
  73. //----------------------------------------------------------------------------------------
  74. //    • Conversion
  75. //
  76. public:
  77.     operator FW_CRectShape() const;
  78.     operator FW_COvalShape() const;
  79.     operator FW_CRoundRectShape() const;
  80.     operator FW_CArcShape() const;
  81.     operator FW_CLineShape() const;
  82.  
  83. //----------------------------------------------------------------------------------------
  84. //    • Static Methods
  85. //
  86. public:
  87.     static void DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape);
  88. };
  89.  
  90. //==============================================================================
  91. //    •• class FW_CRegionShapeRep
  92. //==============================================================================
  93.  
  94. class FW_CRegionShapeRep : public FW_CShapeRep
  95. {
  96.     friend class FW_CRegionShape;
  97.     
  98. //------------------------------------------------------------------------------
  99. //    • Constructors/Destructors
  100. //
  101. protected:
  102.     FW_CRegionShapeRep();
  103.     FW_CRegionShapeRep(XMPShape* xmpShape);
  104.     FW_CRegionShapeRep(const FW_CRect& rect);
  105.     
  106.     virtual ~FW_CRegionShapeRep();
  107.  
  108. //------------------------------------------------------------------------------
  109. //    • Inherited API
  110. //
  111. public:
  112.     // ----- Hit Testing -----
  113.     virtual FW_HitTestPart HitTest(const FW_CPoint& test) const;
  114.  
  115.     // ----- Rendering -----
  116.     virtual void    Draw(FW_CGraphicContext* graphicContext);
  117.     static void    DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape);
  118.     
  119.     // ----- Transform -----
  120.     virtual void    Transform(XMPTransform* transform);
  121.     virtual void    InverseTransform(XMPTransform* transform);
  122.  
  123.     virtual void    MoveShape(XMPCoordinate deltaX, XMPCoordinate deltaY);
  124.     virtual void    MoveShapeTo(XMPCoordinate x, XMPCoordinate y);
  125.  
  126.     // ----- Geometry -----
  127.     virtual FW_CRect GetShapeBounds() const;
  128.  
  129.     // ----- Default shape -----
  130.     virtual void     SetAsDefault() const;
  131.  
  132.     // ----- Stream -----
  133.     virtual void    Flatten(FW_CWritableStream& stream);
  134.     virtual void    Unflatten(FW_CReadableStream& stream);
  135.  
  136. //------------------------------------------------------------------------------
  137. //    • New API
  138. //
  139. public:
  140.     FW_CRegionShape    Copy() const;
  141.  
  142.     void            GetXMPShape(XMPShape* xmpShape) const
  143.                             {xmpShape->CopyFrom(fXMPShape);}
  144.     void            SetXMPShape(XMPShape* xmpShape);
  145.     
  146. //------------------------------------------------------------------------------
  147. //    • Data Members
  148. //
  149. private:
  150.     XMPShape*        fXMPShape;
  151. };
  152.  
  153. //==============================================================================
  154. //    •• Inlines
  155. //==============================================================================
  156.  
  157. //------------------------------------------------------------------------------
  158. //    • FW_CRegionShape::DrawRegion
  159. //------------------------------------------------------------------------------
  160. inline static void FW_CRegionShape::DrawRegion(FW_CGraphicContext* graphicContext, XMPShape* xmpShape)
  161. {
  162.     FW_CRegionShapeRep::DrawRegion(graphicContext, xmpShape);
  163. }
  164.  
  165. #endif
  166.